Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
dom-scroll-into-view
Advanced tools
The 'dom-scroll-into-view' npm package provides utilities to smoothly scroll a DOM element into view within its container. It offers customizable options to control the alignment and behavior of the scrolling action.
Basic Scroll Into View
This feature allows you to scroll a specific DOM element into view within its container. The example demonstrates how to scroll an element with the ID 'targetElement' into view within the document body.
const scrollIntoView = require('dom-scroll-into-view');
const element = document.getElementById('targetElement');
scrollIntoView(element, document.body);
Custom Alignment
This feature allows you to customize the alignment of the element when it is scrolled into view. The example shows how to align the element with the top of the container.
const scrollIntoView = require('dom-scroll-into-view');
const element = document.getElementById('targetElement');
scrollIntoView(element, document.body, { alignWithTop: true });
Smooth Scrolling
This feature enables smooth scrolling when bringing an element into view. The example demonstrates how to scroll the element smoothly into view within the document body.
const scrollIntoView = require('dom-scroll-into-view');
const element = document.getElementById('targetElement');
scrollIntoView(element, document.body, { behavior: 'smooth' });
The 'scroll-into-view-if-needed' package provides similar functionality to 'dom-scroll-into-view' but with additional options for controlling the scrolling behavior. It offers more granular control over when and how the scrolling should occur, including options for center alignment and ensuring the element is fully visible.
The 'smooth-scroll-into-view-if-needed' package extends the functionality of 'scroll-into-view-if-needed' by adding smooth scrolling capabilities. It provides a more modern and user-friendly scrolling experience, similar to 'dom-scroll-into-view' but with enhanced smooth scrolling options.
scroll node in contain to make node visible
var scrollIntoView = require('dom-scroll-into-view');
scrollIntoView(source,container,config);
npm install
npm start
http://localhost:8000/examples/
online example: http://yiminghe.github.io/dom-scroll-into-view/
name | type | default | description |
---|---|---|---|
source | HTMLElement | node wanted to show | |
container | HTMLElement | ||
config.alignWithLeft | Boolean | whether align with left edge | |
config.alignWithTop | Boolean | whether align with top edge | |
config.offsetTop | Number | ||
config.offsetLeft | Number | ||
config.offsetBottom | Number | ||
config.offsetRight | Number | ||
config.allowHorizontalScroll | Boolean | whether allow horizontal scroll container | |
config.onlyScrollIfNeeded | Boolean | whether scroll container when source is visible |
dom-scroll-into-view is released under the MIT license.
FAQs
scroll dom node into view automatically
The npm package dom-scroll-into-view receives a total of 299,529 weekly downloads. As such, dom-scroll-into-view popularity was classified as popular.
We found that dom-scroll-into-view demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.